﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace CalculadoraDeMatriz
{
    public partial class Form1 : Form
    {


        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            radioButton5.Checked = true;
            radioButton1.Checked = true;
            label6.Text = "";
            label11.Text = "";
            label7.Text = "";
            label6.Text = "";
            label11.Text = "";
            label7.Text = "";
            label10.Text = "";
            label14.Text = "";
            label13.Text = "";
            label8.Text = "";
            label9.Text = "";
            label12.Text = "";
            label10.Text = "";

        }
        // 1X1 A
        private void radioButton1_CheckedChanged(object sender, EventArgs e)
        {
            if (radioButton1.Checked == true)
            {
                textBox1.Enabled = true;//1.1
                textBox2.Enabled = false;//2.1
                textBox3.Enabled = false;//3.1
                textBox4.Enabled = false;//3.2
                textBox5.Enabled = false;//2.2
                textBox6.Enabled = false;//1.2
                textBox7.Enabled = false;//3.3
                textBox8.Enabled = false;//3.2
                textBox9.Enabled = false;//3.1
                MessageBox.Show("Foi1");
            }
        }
        // 2X2 A
        private void radioButton2_CheckedChanged(object sender, EventArgs e)
        {
            if (radioButton2.Checked == true)
            {
                textBox1.Enabled = true;//1.1
                textBox2.Enabled = true;//2.1
                textBox3.Enabled = false;//3.1
                textBox4.Enabled = false;//3.2
                textBox5.Enabled = true;//2.2
                textBox6.Enabled = true;//1.2
                textBox7.Enabled = false;//3.3
                textBox8.Enabled = false;//3.2
                textBox9.Enabled = false;//3.1
                MessageBox.Show("Foi2");
            }
        }
        // 3X3 A
        private void radioButton3_CheckedChanged(object sender, EventArgs e)
        {
            if (radioButton3.Checked == true)
            {
                textBox1.Enabled = true;//1.1
                textBox2.Enabled = true;//2.1
                textBox3.Enabled = true;//3.1
                textBox4.Enabled = true;//3.2
                textBox5.Enabled = true;//2.2
                textBox6.Enabled = true;//1.2
                textBox7.Enabled = true;//3.3
                textBox8.Enabled = true;//3.2
                textBox9.Enabled = true;//3.1
                MessageBox.Show("Foi3");
            }
        }

        // 1X1 B
        private void radioButton5_CheckedChanged(object sender, EventArgs e)
        {
            if (radioButton5.Checked == true)
            {
                textBox18.Enabled = true;//1.1
                textBox17.Enabled = false;//2.1
                textBox16.Enabled = false;//3.1
                textBox15.Enabled = false;//1.2
                textBox14.Enabled = false;//2.2
                textBox13.Enabled = false;//3.2
                textBox12.Enabled = false;//1.3
                textBox11.Enabled = false;//2.3
                textBox10.Enabled = false;//3.3
                MessageBox.Show("Foi5");
            }
        }
        // 2X2 B
        private void radioButton6_CheckedChanged(object sender, EventArgs e)
        {
            if (radioButton6.Checked == true)
            {
                textBox18.Enabled = true;//1.1
                textBox17.Enabled = true;//2.1
                textBox16.Enabled = false;//3.1
                textBox15.Enabled = true;//1.2
                textBox14.Enabled = true;//2.2
                textBox13.Enabled = false;//3.2
                textBox12.Enabled = false;//1.3
                textBox11.Enabled = false;//2.3
                textBox10.Enabled = false;//3.3
                MessageBox.Show("Foi6");
            }
        }
        // 3X3 B
        private void radioButton7_CheckedChanged(object sender, EventArgs e)
        {
                if (radioButton7.Checked == true)
                {
                    textBox18.Enabled = true;//1.1
                    textBox17.Enabled = true;//2.1
                    textBox16.Enabled = true;//3.1
                    textBox15.Enabled = true;//1.2
                    textBox14.Enabled = true;//2.2
                    textBox13.Enabled = true;//3.2
                    textBox12.Enabled = true;//1.3
                    textBox11.Enabled = true;//2.3
                    textBox10.Enabled = true;//3.3
                    MessageBox.Show("Foi7");
                }
        }


        // 1 ao 9 -> Matriz A
        private void textBox1_TextChanged(object sender, EventArgs e)
        {

        }

        private void textBox2_TextChanged(object sender, EventArgs e)
        {

        }

        private void textBox3_TextChanged(object sender, EventArgs e)
        {

        }

        private void textBox4_TextChanged(object sender, EventArgs e)
        {

        }

        private void textBox5_TextChanged(object sender, EventArgs e)
        {

        }

        private void textBox6_TextChanged(object sender, EventArgs e)
        {

        }

        private void textBox7_TextChanged(object sender, EventArgs e)
        {

        }

        private void textBox8_TextChanged(object sender, EventArgs e)
        {

        }

        private void textBox9_TextChanged(object sender, EventArgs e)
        {

        }
        // 9 ao 18 -> Matriz B
        private void textBox10_TextChanged(object sender, EventArgs e)
        {

        }

        private void textBox11_TextChanged(object sender, EventArgs e)
        {

        }

        private void textBox12_TextChanged(object sender, EventArgs e)
        {

        }

        private void textBox13_TextChanged(object sender, EventArgs e)
        {

        }

        private void textBox14_TextChanged(object sender, EventArgs e)
        {

        }

        private void textBox15_TextChanged(object sender, EventArgs e)
        {

        }

        private void textBox16_TextChanged(object sender, EventArgs e)
        {

        }

        private void textBox17_TextChanged(object sender, EventArgs e)
        {

        }

        private void textBox18_TextChanged(object sender, EventArgs e)
        {

        }

        private void button1_Click(object sender, EventArgs e)
        {
            label4.Text = button1.Text;
            if (radioButton1.Checked == true || radioButton5.Checked == true)
            {
                int x = Convert.ToInt32(textBox1.Text);
                int y = Convert.ToInt32(textBox18.Text);
                int z = x + y;
                label6.Text = Convert.ToString(z);
                
            }
            if (radioButton2.Checked == true || radioButton6.Checked == true)
            {
                int a = Convert.ToInt32(textBox1.Text);
                int b = Convert.ToInt32(textBox18.Text);

                int c = Convert.ToInt32(textBox2.Text);
                int d = Convert.ToInt32(textBox17.Text);

                int E = Convert.ToInt32(textBox6.Text);
                int f = Convert.ToInt32(textBox15.Text);

                int g = Convert.ToInt32(textBox5.Text);
                int h = Convert.ToInt32(textBox14.Text);

                
                int x = a + b;
                int y = c + d; 
                int z = E + f;
                int w = g + h;

                label6.Text = Convert.ToString(x);
                label11.Text = Convert.ToString(y);
                label7.Text = Convert.ToString(z);
                label10.Text = Convert.ToString(w);
            }
            if (radioButton3.Checked == true || radioButton7.Checked == true)
            {
                int a = Convert.ToInt32(textBox1.Text);
                int b = Convert.ToInt32(textBox18.Text);

                int c = Convert.ToInt32(textBox2.Text);
                int d = Convert.ToInt32(textBox17.Text);

                int E = Convert.ToInt32(textBox6.Text);
                int f = Convert.ToInt32(textBox15.Text);

                int g = Convert.ToInt32(textBox5.Text);
                int h = Convert.ToInt32(textBox14.Text);

                int i = Convert.ToInt32(textBox3.Text); 
                int j = Convert.ToInt32(textBox16.Text);

                int k = Convert.ToInt32(textBox4.Text);
                int l = Convert.ToInt32(textBox13.Text);

                int m = Convert.ToInt32(textBox9.Text);
                int n = Convert.ToInt32(textBox12.Text);

                int o = Convert.ToInt32(textBox8.Text);
                int p = Convert.ToInt32(textBox11.Text);

                int q = Convert.ToInt32(textBox7.Text);
                int r = Convert.ToInt32(textBox10.Text); 

                int x = a + b;
                int y = c + d;
                int z = E + f;
                int w = g + h;
                int xx = i + j;
                int xy = k + l;
                int xz = m + n;
                int xw = o + p;
                int wx = q + r;

                label6.Text = Convert.ToString(x);
                label11.Text = Convert.ToString(y);
                label7.Text = Convert.ToString(z);
                label10.Text = Convert.ToString(w);
                label14.Text = Convert.ToString(xx);
                label13.Text = Convert.ToString(xy);
                label8.Text = Convert.ToString(xz);
                label9.Text = Convert.ToString(xw);
                label12.Text = Convert.ToString(wx);
            }

        }

        private void button2_Click(object sender, EventArgs e)
        {
            label4.Text = button2.Text;
            if (radioButton1.Checked == true || radioButton5.Checked == true)
            {
                int x = Convert.ToInt32(textBox1.Text);
                int y = Convert.ToInt32(textBox18.Text);
                int z = x - y;
                label6.Text = Convert.ToString(z);

            }
            if (radioButton2.Checked == true || radioButton6.Checked == true)
            {
                int a = Convert.ToInt32(textBox1.Text);
                int b = Convert.ToInt32(textBox18.Text);

                int c = Convert.ToInt32(textBox2.Text);
                int d = Convert.ToInt32(textBox17.Text);

                int E = Convert.ToInt32(textBox6.Text);
                int f = Convert.ToInt32(textBox15.Text);

                int g = Convert.ToInt32(textBox5.Text);
                int h = Convert.ToInt32(textBox14.Text);


                int x = a - b;
                int y = c - d;
                int z = E - f;
                int w = g - h;

                label6.Text = Convert.ToString(x);
                label11.Text = Convert.ToString(y);
                label7.Text = Convert.ToString(z);
                label10.Text = Convert.ToString(w);
            }
            if (radioButton3.Checked == true || radioButton7.Checked == true)
            {
                int a = Convert.ToInt32(textBox1.Text);
                int b = Convert.ToInt32(textBox18.Text);

                int c = Convert.ToInt32(textBox2.Text);
                int d = Convert.ToInt32(textBox17.Text);

                int E = Convert.ToInt32(textBox6.Text);
                int f = Convert.ToInt32(textBox15.Text);

                int g = Convert.ToInt32(textBox5.Text);
                int h = Convert.ToInt32(textBox14.Text);

                int i = Convert.ToInt32(textBox3.Text);
                int j = Convert.ToInt32(textBox16.Text);

                int k = Convert.ToInt32(textBox4.Text);
                int l = Convert.ToInt32(textBox13.Text);

                int m = Convert.ToInt32(textBox9.Text);
                int n = Convert.ToInt32(textBox12.Text);

                int o = Convert.ToInt32(textBox8.Text);
                int p = Convert.ToInt32(textBox11.Text);

                int q = Convert.ToInt32(textBox7.Text);
                int r = Convert.ToInt32(textBox10.Text);

                int x = a - b;
                int y = c - d;
                int z = E - f;
                int w = g - h;
                int xx = i - j;
                int xy = k - l;
                int xz = m - n;
                int xw = o - p;
                int wx = q - r;

                label6.Text = Convert.ToString(x);
                label11.Text = Convert.ToString(y);
                label7.Text = Convert.ToString(z);
                label10.Text = Convert.ToString(w);
                label14.Text = Convert.ToString(xx);
                label13.Text = Convert.ToString(xy);
                label8.Text = Convert.ToString(xz);
                label9.Text = Convert.ToString(xw);
                label12.Text = Convert.ToString(wx);
            }


        }

        private void button3_Click(object sender, EventArgs e)
        {
            label4.Text = button3.Text;
        }

        private void checkBox1_CheckedChanged(object sender, EventArgs e)
        {

        }

        private void checkBox2_CheckedChanged(object sender, EventArgs e)
        {

        }

        private void label4_Click(object sender, EventArgs e)
        {

        }

        private void textBox27_TextChanged(object sender, EventArgs e)
        {

        }

        private void textBox26_TextChanged(object sender, EventArgs e)
        {

        }

        private void textBox25_TextChanged(object sender, EventArgs e)
        {

        }

        private void textBox22_TextChanged(object sender, EventArgs e)
        {

        }

        private void textBox20_TextChanged(object sender, EventArgs e)
        {

        }

        private void textBox24_TextChanged(object sender, EventArgs e)
        {

        }

        private void textBox21_TextChanged(object sender, EventArgs e)
        {

        }

        private void textBox23_TextChanged(object sender, EventArgs e)
        {

        }

        private void textBox19_TextChanged(object sender, EventArgs e)
        {

        }

        private void label13_Click(object sender, EventArgs e)
        {

        }

        private void label12_Click(object sender, EventArgs e)
        {

        }

        private void label14_Click(object sender, EventArgs e)
        {

        }

        private void label6_Click(object sender, EventArgs e)
        {

        }

        private void label11_Click(object sender, EventArgs e)
        {

        }

        private void label7_Click(object sender, EventArgs e)
        {

        }

        private void label10_Click(object sender, EventArgs e)
        {

        }

        private void label8_Click(object sender, EventArgs e)
        {

        }

        private void label9_Click(object sender, EventArgs e)
        {

        }

       







    }
}
